/**
 * main.m by Giraldo Rosales.
 * Visit www.liquidgear.net for documentation and updates.
 *
 *
 * Copyright (c) 2009 Nitrogen Design, Inc. All rights reserved.
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 **/

BOOL LG_SCALE_TO_FIT;
NSString *LG_SFX_STARTUP;
BOOL LG_EVENT_DOUBLE;
BOOL LG_EVENT_SHAKEEDIT;
BOOL LG_IDLE;
BOOL LG_IDLE_CUSTOM;
int LG_IDLE_TIME;
NSString *LG_VERSION_APP;
NSString *LG_VERSION_LG;
NSString *LG_THROB_COLOR;

#if LG_USE_ADMOB
NSString *LG_ADMOB_POSITION;
NSString *LG_ADMOB_PUBID;
BOOL LG_ADMOB_TEST;
BOOL LG_ADMOB_ASKLOCATION;
NSString *LG_ADMOB_BGCOLOR;
NSString *LG_ADMOB_TXTCOLOR1;
NSString *LG_ADMOB_TXTCOLOR2;
#endif

#if LG_USE_NAVBAR
BOOL LG_NAV_PROMPT;
#endif

int main(int argc, char *argv[]) {
	NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  Settings *settings = [[[Settings alloc] autorelease] init];
	
	LG_SCALE_TO_FIT	= [[settings.LGSettings objectForKey:@"ScalesPageToFit"] boolValue];
	LG_SFX_STARTUP	= [settings.LGSettings objectForKey:@"StartupSound"];
	LG_VERSION_APP	= [settings.LGSettings objectForKey:@"AppVersion"];
	LG_THROB_COLOR	= [settings.LGSettings objectForKey:@"Throbber"];
	
	NSDictionary *eventConfig	= [settings.LGSettings objectForKey:@"Events"];
	LG_EVENT_DOUBLE			= [[eventConfig objectForKey:@"DoubleClick"] boolValue];
	LG_EVENT_SHAKEEDIT	= [[eventConfig objectForKey:@"ShakeToEdit"] boolValue];
	
	NSDictionary *idleConfig	= [settings.LGSettings objectForKey:@"Idle"];
	LG_IDLE					= [[idleConfig objectForKey:@"Disable"] boolValue];
	LG_IDLE_CUSTOM	= [[idleConfig objectForKey:@"CustomIdle"] boolValue];
	LG_IDLE_TIME		= [[idleConfig objectForKey:@"MaxIdle"] intValue];
	
#if LG_USE_ADMOB
	NSDictionary *admobConfig	= [settings.LGSettings objectForKey:@"AdMob"];
	LG_ADMOB_POSITION					= [admobConfig objectForKey:@"Position"];
	LG_ADMOB_PUBID						= [admobConfig objectForKey:@"PublisherID"];
	LG_ADMOB_TEST							= [[admobConfig objectForKey:@"Test"] boolValue];
	LG_ADMOB_ASKLOCATION			= [[admobConfig objectForKey:@"AskForLocation"] boolValue];
	LG_ADMOB_BGCOLOR					= [admobConfig objectForKey:@"BackgroundColor"];
	LG_ADMOB_TXTCOLOR1				= [admobConfig objectForKey:@"PrimaryTextColor"];
	LG_ADMOB_TXTCOLOR2				= [admobConfig objectForKey:@"SecondaryTextColor"];
#endif
	
#if LG_USE_NAVBAR
	NSDictionary *navConfig	= [settings.LGSettings objectForKey:@"NavBar"];
	LG_NAV_PROMPT						= [[navConfig objectForKey:@"UsePrompt"] boolValue];
#endif
	
	int retVal = UIApplicationMain(argc, argv, @"LiquidGearAppDelegate", @"LiquidGearAppDelegate");
	[pool release];
	return retVal;
}
